package com.design.yjx.command.common;

/**
 * @author yuanjianxin
 * @date 2017/8/21 14:53
 */
public class Fan {
    public enum Speed {
        OFF(0, "关闭"), LOW(1, "低速"), MID(2, "中速"), HIGH(3, "高速");
        private int value;
        private String msg;

        Speed(int value, String msg) {
            this.value = value;
            this.msg = msg;
        }

        public int getValue() {
            return value;
        }

        public String getMsg() {
            return msg;
        }
    }

    //状态
    private Speed speed;

    public Speed getSpeed() {
        return speed;
    }

    public void setSpeed(Speed speed) {
        this.speed = speed;
    }

    public void on() {
        System.out.println("开风扇");
    }

    public void off() {
        System.out.println("关风扇");
    }

    @Override
    public String toString() {
        return "Fan{" +
                "speed=" + speed.getMsg() +
                '}';
    }
}
